Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
emojibase-regex
Advanced tools
The emojibase-regex npm package provides regular expressions for matching emoji characters and sequences. It is useful for developers who need to identify, extract, or manipulate emoji in text.
Match all emoji
This feature allows you to match all emoji characters in a given text string. The regular expression provided by emojibase-regex can be used to find all emoji in a text.
const emojiRegex = require('emojibase-regex');
const text = 'Hello, world! 🌍😊';
const matches = text.match(emojiRegex);
console.log(matches); // ['🌍', '😊']
Match emoji sequences
This feature allows you to match complex emoji sequences, such as family emojis or flag sequences. The sequences regex is specifically designed to handle these multi-character emoji.
const emojiRegex = require('emojibase-regex/sequences');
const text = 'Family: 👨👩👧👦';
const matches = text.match(emojiRegex);
console.log(matches); // ['👨👩👧👦']
Match emoji with skin tones
This feature allows you to match emoji that include skin tone modifiers. The tones regex is designed to recognize these variations.
const emojiRegex = require('emojibase-regex/tones');
const text = 'Thumbs up: 👍🏽';
const matches = text.match(emojiRegex);
console.log(matches); // ['👍🏽']
The emoji-regex package provides a regular expression to match all emoji symbols and sequences. It is similar to emojibase-regex but does not offer separate regexes for sequences or skin tones.
The twemoji-parser package from Twitter's Twemoji project provides utilities to parse and extract emoji from text. It offers more comprehensive parsing capabilities but is more complex and heavier than emojibase-regex.
The node-emoji package provides a simple way to find and replace emoji in text. It includes a dictionary of emoji names and their corresponding characters, but it does not focus on regular expressions like emojibase-regex.
Install the package.
yarn add emojibase-regex
Import and use the RegExp
pattern.
import EMOJI_REGEX from 'emojibase-regex';
import EMOTICON_REGEX from 'emojibase-regex/emoticon';
import SHORTCODE_REGEX from 'emojibase-regex/shortcode';
import SHORTCODE_NATIVE_REGEX from 'emojibase-regex/shortcode-native';
`🏰`.match(EMOJI_REGEX);
':)'.match(EMOTICON_REGEX);
':castle:'.match(SHORTCODE_REGEX);
':гвинея:'.match(SHORTCODE_NATIVE_REGEX);
FAQs
Evergreen emoji regex patterns.
The npm package emojibase-regex receives a total of 156,644 weekly downloads. As such, emojibase-regex popularity was classified as popular.
We found that emojibase-regex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.